From: Rui Matos Date: Wed, 16 Jan 2013 23:21:14 +0000 (+0100) Subject: ibusCandidatePopup: Make candidates reactive to pointer clicks X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4859 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c3ed9367766f195fe6bfeca21a812128cecb7ee6;p=gnome-shell.git ibusCandidatePopup: Make candidates reactive to pointer clicks Allow for candidates to be selected by clicking on them. https://bugzilla.gnome.org/show_bug.cgi?id=691902 --- diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 8e5bdc1a8..8fca629fd 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -2126,6 +2126,10 @@ StScrollBar StButton#vhandle:active { background-color: rgba(255,255,255,0.2); } +.candidate-box:hover { + border-radius: 4px; + background-color: rgba(255,255,255,0.1); +} .candidate-page-button-box { height: 2em; width: 80px; diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index bfebf168a..bbc65a0f9 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -19,13 +19,20 @@ const CandidateArea = new Lang.Class({ visible: false }); this._candidateBoxes = []; for (let i = 0; i < MAX_CANDIDATES_PER_PAGE; ++i) { - let box = new St.BoxLayout({ style_class: 'candidate-box' }); + let box = new St.BoxLayout({ style_class: 'candidate-box', + reactive: true, + track_hover: true }); box._indexLabel = new St.Label({ style_class: 'candidate-index' }); box._candidateLabel = new St.Label({ style_class: 'candidate-label' }); box.add(box._indexLabel, { y_fill: false }); box.add(box._candidateLabel, { y_fill: false }); this._candidateBoxes.push(box); this.actor.add(box); + + let j = i; + box.connect('button-release-event', Lang.bind(this, function(actor, event) { + this.emit('candidate-clicked', j, event.get_button(), event.get_state()); + })); } this._buttonBox = new St.BoxLayout({ style_class: 'candidate-page-button-box' }); @@ -136,6 +143,9 @@ const CandidatePopup = new Lang.Class({ this._candidateArea.connect('next-page', Lang.bind(this, function() { this._panelService.page_down(); })); + this._candidateArea.connect('candidate-clicked', Lang.bind(this, function(ca, index, button, state) { + this._panelService.candidate_clicked(index, button, state); + })); this._panelService = null; },